package com.forte.shoppingcustomer;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

import com.forte.cartdao.Cart;
import com.forte.shoppingcustomerdao.Address;
import com.forte.shoppingcustomerdao.ShoppingCustomer;
import com.forte.shoppingcustomerdao.ShoppingCustomerDAO;

public class ShoppingCustomerServiceImpl implements ShoppingCustomerService{
	
	@Autowired
	@Qualifier("shoppingCustomerDAO")
	ShoppingCustomerDAO customerDao;
	
	public void setShoppingCustomerDAO(ShoppingCustomerDAO customerDao){
		this.customerDao = customerDao;
	}

	public void saveOrUpdate(ShoppingCustomer customer) {
		customerDao.saveOrUpdate(customer);		
	}

	public void saveOrUpdate(Address address) {
		customerDao.saveOrUpdate(address);		
	}

	public void saveOrUpdate(Cart cart) {
		customerDao.saveOrUpdate(cart);		
	}

	public ShoppingCustomer findCustomerByCustomerId(int customerId) {
		return customerDao.findCustomerByCustomerId(customerId);
	}

	public ShoppingCustomer findCustomerByEmailAndPassword(String email,
			String password) {
		return customerDao.findCustomerByEmailAndPassword(email, password);
	}

	public ShoppingCustomer findCustomerByEmail(String email) {
		return customerDao.findCustomerByEmail(email);
	}

	public List<Address> findAllAddress() {
		return customerDao.findAllAddress();
	}

	public Address findAddressByAddressId(int addressId) {
		return customerDao.findAddressByAddressId(addressId);
	}
}
